#coding=utf-8
"""
Author:陆孝
Time:2025/9/4 0004 10:09
"""

import requests
class Send_Requests():
    '''封装了一个发送接口请求的工具类'''
    def __init__(self):
        '''创建session对象用来保持会话'''
        self.session = requests.session()

    def send(self,method,url,data=None,json=None,params=None,headers=None):
        method = method.lower()
        if method == 'get':
            response = self.session.get(url,params)
        elif method == "post":
            response = self.session.post(url,data,headers)
        elif method == "post_json":
            response = self.session.post(url,json,headers)
        elif method == 'delete':
            response = self.session.delete(url)
        return response